package com.alibaba.nacos.core.cluster;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Getter
@Setter
@Accessors(chain = true)
public class Member {
    private String ip;
    private int port;
    private volatile NodeState nodeState = NodeState.UP;
    private Map<String, Object> extendInfo = new ConcurrentHashMap<>();
    private String address;
    private transient int failAccessCnt = 0;
    private boolean grpcReportEnabled = false;

    public String getAddress() {
        if (StringUtils.isBlank(address)) {
            this.address = ip + ":" + port;
        }

        return address;
    }
}

